import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
import terser from '@rollup/plugin-terser';
import vue from 'rollup-plugin-vue';
import postcss from 'rollup-plugin-postcss';

export default [
	// Vue版本
	{
		input: 'src/vue/index.js',
		output: {
			file: 'dist/vue/index.js',
			format: 'esm',
			sourcemap: true
		},
		external: ['vue'],
		plugins: [
			vue(),
			postcss({
				extract: false,
				modules: false,
				use: ['sass']
			}),
			babel({
				babelHelpers: 'bundled',
				exclude: 'node_modules/**'
			}),
			resolve(),
			commonjs(),
			terser()
		]
	},
	// React版本
	{
		input: 'src/react/index.js',
		output: {
			file: 'dist/react/index.js',
			format: 'esm',
			sourcemap: true
		},
		external: ['react', 'react-dom'],
		plugins: [
			postcss({
				extract: false,
				modules: false,
				use: ['sass']
			}),
			babel({
				babelHelpers: 'bundled',
				presets: ['@babel/preset-react'],
				exclude: 'node_modules/**'
			}),
			resolve(),
			commonjs(),
			terser()
		]
	}
];